package com.cartoon.controller;

import com.cartoon.entity.Cartoon;
import com.cartoon.service.CartoonService;
import com.cartoon.util.ResponseData;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Cartoon)表控制层
 *
 * @author makejava
 * @since 2021-12-10 11:28:08
 */
@RestController
@RequestMapping("cartoon")
public class CartoonController {
    /**
     * 服务对象
     */
    @Resource
    private CartoonService cartoonService;

    @GetMapping("getCartoonInfo")//分页获取首页漫画展示并按点击量由高到低排序
     public ResponseData getCartoonInfo(Long page,Long limit){
         return cartoonService.getCartoonInfo(page,limit);
     }
     @GetMapping("getCartoonClassificationInfo")//获取分类页面的漫画信息
     public ResponseData getCartoonClassificationInfo(){
        return cartoonService.getCartoonClassificationInfo();
     }
     @GetMapping("getCartoonById")
     public  ResponseData getCartoonById(int id){
         return cartoonService.getCartoonById(id);
     }
     @GetMapping("updateHits")
     public ResponseData updateHits(int cartoonId){
        return cartoonService.updateHits(cartoonId);
     }
     @GetMapping("getUpdateCartoon")
     public ResponseData getUpdateCartoon(){
        return cartoonService.getUpdateCartoon();
     }
}

